package com.zhilong;

import com.google.gson.Gson;

public final class NotificationMessage
{
	private NotificationMessage() {}
	private int code = 0;
	private String content = null;
	
	public static final int MC_CAMP_WAIT_FOR_PLAYERS			= 1; 
	public static final int MC_CAMP_STARTED						= 2; 
	public static final int MC_ANSWER_CORRECT 					= 3; 
	public static final int MC_ANSWER_INCORRECT 				= 4; 
	public static final int MC_COMPETITION_FAIL 				= 5; 
	public static final int MC_COMPETITION_SUCCESS 				= 6; 
	public static final int MC_CAMP_USER_EXIT 					= 7; 
	public static final int MC_TIMEOUT 							= 8; 
	
	public static final int MC_QUESTION		 					= 101;  
	
	public int getCode()
	{
		return code;
	}
	
	public String getContent()
	{
		return content;
	}
	
	public static int getMessageCode(String msg)
	{
        Gson gson = new Gson(); 
        NotificationMessage nm = gson.fromJson(msg, NotificationMessage.class);
        
		return nm.getCode();
	}
	
	public static String getMessageContent(String msg)
	{
        Gson gson = new Gson(); 
        NotificationMessage nm = gson.fromJson(msg, NotificationMessage.class);
		
		return nm.getContent();
	}
}
